#ifndef _AS_MESSAGE_H_
#define _AS_MESSAGE_H_

#include "ASCommon.h"


NS_AS_BEGIN

class ASObject
{
public:
	ASObject();
	virtual ~ASObject();
	unsigned int getASObjectID(){return _nASObjectID;}
	sigslot::signal1<ASObject*> _SignalDestory;
#ifdef ASOBJ_REFCOUNT
	void retain()
	{
		//ASAssert(_nReferenceCount > 0, "reference count should greater than 0");
		++_nReferenceCount;
	};
	void release()
	{
		//ASAssert(_nReferenceCount > 0, "reference count should greater than 0");
		--_nReferenceCount;
    
		if (_nReferenceCount == 0)
		{
			delete this;
		}
	}
#endif
private:
	unsigned int _nASObjectID;
#ifdef ASOBJ_REFCOUNT
	unsigned int _nReferenceCount;
#endif
};

typedef void (ASObject::*SEL_CallFunc)();
typedef void (ASObject::*SEL_CallFuncD)(void*);
typedef void (ASObject::*SEL_CallFuncO)(ASObject*);

#define ascallfunc_selector(_SELECTOR)	static_cast<AS::SEL_CallFunc>(&_SELECTOR)
#define ascallfuncD_selector(_SELECTOR)	static_cast<AS::SEL_CallFuncD>(&_SELECTOR)
#define ascallfuncO_selector(_SELECTOR)	static_cast<AS::SEL_CallFuncO>(&_SELECTOR)

NS_AS_END

#endif
